feat: add certificate management v2 API endpoints#38404
Conversation
- Add ToggleCertificateGenerationView endpoint to enable/disable certificate generation - Add CertificateExceptionsView endpoint to grant and remove certificate exceptions (allowlist) - Add CertificateInvalidationsView endpoint to invalidate and re-validate certificates - Update certificate status labels to be more user-friendly (e.g., "Received" instead of "already received") - Update certificate generation history labels (e.g., "All Learners" instead of "All learners") - Add invalidation notes to IssuedCertificateSerializer - Add certificatesEnabled flag to CourseInformationSerializerV2
|
Thanks for the pull request, @wgu-jesse-stewart! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
There was a problem hiding this comment.
Pull request overview
Adds new Instructor Dashboard v2 endpoints to manage course certificate generation, exceptions (allowlist), and invalidations, plus updates to certificate-related labels/serialization to support the React-based instructor dashboard UI.
Changes:
- Introduces v2 API endpoints to toggle certificate generation, manage certificate exceptions, and manage certificate invalidations.
- Extends v2 serializers to expose certificate-management availability and invalidation notes.
- Updates certificate status/history “human-readable” labels and adjusts related tests.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 16 comments.
Show a summary per file
| File | Description |
|---|---|
| lms/djangoapps/instructor/views/serializers_v2.py | Adds certificates_enabled and invalidation_note to v2 serializers. |
| lms/djangoapps/instructor/views/api_v2.py | Adds new v2 certificate management APIViews and extends issued-certs context with invalidation notes. |
| lms/djangoapps/instructor/views/api_urls.py | Wires new v2 certificate management routes. |
| lms/djangoapps/instructor/tests/test_api_v2.py | Updates expected certificate generation history label casing. |
| lms/djangoapps/certificates/tests/test_models.py | Updates expected label strings for generation history candidate rendering. |
| lms/djangoapps/certificates/models.py | Updates generation history candidate strings (“All Learners”, “Granted Exceptions”). |
| lms/djangoapps/certificates/data.py | Updates human-readable certificate status labels and adds mapping for unavailable. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
dwong2708
left a comment
There was a problem hiding this comment.
Thanks for all the effort. I’ve left my first round of reviews.
dwong2708
left a comment
There was a problem hiding this comment.
These should be the latest suggestions. Thanks!
… of https://github.com/WGU-Open-edX/edx-platform into wgu-jesse-stewart/instructor_dashboard_certificates_v2
dwong2708
left a comment
There was a problem hiding this comment.
LGTM. Thanks for all your effort!
wgu-taylor-payne
left a comment
There was a problem hiding this comment.
Nice work on the new certificate management endpoints — the bulk validation helpers and test coverage are solid. A few items below.
Review assisted by Kiro
wgu-taylor-payne
left a comment
There was a problem hiding this comment.
Thanks, looks good.
Description
This PR adds comprehensive v2 API endpoints for certificate management in the instructor dashboard, supporting the new React-based instructor dashboard UI.
Changes include:
New API Endpoints:
POST /api/instructor/v2/courses/{course_id}/certificates/toggle_generation- Enable/disable certificate generation for a coursePOST /api/instructor/v2/courses/{course_id}/certificates/exceptions- Grant certificate exceptions (allowlist) to learnersDELETE /api/instructor/v2/courses/{course_id}/certificates/exceptions- Remove certificate exceptionsPOST /api/instructor/v2/courses/{course_id}/certificates/invalidations- Invalidate certificates for learnersDELETE /api/instructor/v2/courses/{course_id}/certificates/invalidations- Re-validate (remove invalidation) certificatesData Model Updates:
Serializer Enhancements:
invalidation_notefield toIssuedCertificateSerializerto include notes about certificate invalidationscertificates_enabledflag toCourseInformationSerializerV2to indicate if certificate management is availableKey Features:
User Roles Impacted:
Supporting information
Related to the instructor dashboard v2 modernization effort.
Testing instructions
Toggle Certificate Generation:
curl -X POST /api/instructor/v2/courses/{course_id}/certificates/toggle_generation \ -H "Authorization: Bearer {token}" \ -d '{"enabled": false}'Expected: Returns
{"enabled": false}Grant Certificate Exceptions (bulk):
curl -X POST /api/instructor/v2/courses/{course_id}/certificates/exceptions \ -H "Authorization: Bearer {token}" \ -d '{"learners": ["user1", "user2@example.com"], "notes": "Test exception"}'Expected: Returns success/error lists for each learner
Remove Certificate Exception:
curl -X DELETE /api/instructor/v2/courses/{course_id}/certificates/exceptions \ -H "Authorization: Bearer {token}" \ -d '{"username": "user1"}'Expected: Returns success message
Invalidate Certificates (bulk):
curl -X POST /api/instructor/v2/courses/{course_id}/certificates/invalidations \ -H "Authorization: Bearer {token}" \ -d '{"learners": ["user1", "user2@example.com"], "notes": "Reason for invalidation"}'Expected: Returns success/error lists for each learner
Remove Certificate Invalidation:
curl -X DELETE /api/instructor/v2/courses/{course_id}/certificates/invalidations \ -H "Authorization: Bearer {token}" \ -d '{"username": "user1"}'Expected: Returns success message
Deadline
None
Other information